<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>商品搜索演示</title>
    <link rel="stylesheet" href="/styles.css" />
</head>

<body>
<div class="container">
    <header>
        <h1>商品搜索演示</h1>
        <p class="subtitle">Elasticsearch 8 + Spring Boot</p>
    </header>

    <section class="search-bar">
        <input id="q" type="text" placeholder="输入关键字，如: iphone / nike / 华为" />
        <button id="btnSearch">搜索</button>
    </section>

    <section id="results" class="results"></section>
</div>

<script src="/app.js"></script>
<script>
    document.getElementById('btnSearch').addEventListener('click', window.searchProducts);
    document.getElementById('q').addEventListener('keydown', function (e) {
        if (e.key === 'Enter') { window.searchProducts(); }
    });
</script>
</body>

</html>